//
//  WCJPresentationController.swift
//  jackWu
//
//  Created by Lewhaming on 2016/11/23.
//  Copyright © 2016年 IQ. All rights reserved.
//

import UIKit

class WCJPresentationController: UIPresentationController {
//    convenience init(presentViewController : UIViewController, presentingViewController:UIViewController){
//        
//        super.init(presentedViewController: presentViewController, presenting: presentingViewController)
//    }
    //保存菜单rect的对象
    var presentFrame = CGRect()
    
    override func containerViewWillLayoutSubviews() {
        presentedView?.frame = presentFrame
    
        coverButton.addTarget(self, action: #selector(btnClicked ), for: UIControlEvents.touchUpInside)
        //添加蒙版
        containerView?.addSubview(coverButton)
    }
    
    private lazy var coverButton : UIButton = {
        let btn = UIButton()
        btn.frame = UIScreen.main.bounds
        btn.backgroundColor = UIColor.clear
        return btn
    }()
    
    @objc private func btnClicked(){
        IQLog(message:"1")
        presentedViewController.dismiss(animated: true, completion: nil)
    }
    
    
}
